<template>
  <div class="m-box">
    <div v-show="type === 'customer'">
      <el-button type="primary" @click="changeViews('add')" plain
        >新建客户</el-button
      >
      <!-- <el-button type="primary" @click="changeViews('gz')" plain
        >新建客户故障申告通知管理</el-button
      > -->
    </div>
    <div v-show="type === 'dispute'">
      <el-button type="primary" @click="changeViews('zy')" plain
        >新建争议单</el-button
      >
      <el-button type="primary" @click="changeViews('result')" plain
        >结果反馈</el-button
      >
    </div>

    <component
      ref="customer"
      :is="comName"
      style="padding-top: 20px"
    ></component>
  </div>
</template>

<script>
import customerAdd from "@/views/customer/customer-child/CustomerAdd";
import customerGz from "@/views/customer/customer-child/CustomerGz";
import CustomerZy from "@/views/customer/customer-child/CustomerZy";
import CustomerResult from "@/views/customer/customer-dialog/CustomerResult";
export default {
  name: "",
  // props: {
  //   type: {
  //     type: String,
  //     default() {
  //       return "";
  //     },
  //   },
  // },
  data() {
    return {
      comName: "customerAdd",
      type: this.$route.query.type,
    };
  },
  components: {
    customerAdd,
    customerGz,
    CustomerZy,
    CustomerResult,
  },
  created() {},
  mounted() {},
  methods: {
    changeViews(cindex) {
      if (cindex === "add") {
        this.comName = "customerAdd";
        this.$nextTick(() => {
          this.$refs.customer.resetForm("ruleForm");
        });
      } else if (cindex === "gz") {
        this.comName = "customerGz";
      } else if (cindex === "zy") {
        this.comName = "customerZy";
      } else if (cindex === "result") {
        this.comName = "CustomerResult";
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.m-box {
  padding: 0.2rem;
  background: #fff;
}
</style>
